{
  "properties" : { },
  "id" : "01f406809fe2453683beef74bc9c211f",
  "script" : null,
  "groupId" : "5cec3d7ac81d478c81f6046ed83ab5da",
  "name" : "修改告警指标",
  "createTime" : 1727070904855,
  "updateTime" : 1726304895403,
  "lock" : "1",
  "createBy" : "ndmp",
  "updateBy" : "ndmp",
  "path" : "update",
  "method" : "POST",
  "parameters" : [ ],
  "options" : [ ],
  "requestBody" : "{\n    \"id\":\"34\",\n    \"code\":\"777\",\n    \"metircCategory\":\"0\",\n    \"metircDescr\":\"hhh\",\n    \"metircName\":\"kksjd\",\n    \"metircTypeId\":\"13\"\n}",
  "headers" : [ ],
  "paths" : [ ],
  "responseBody" : "{\n    \"status\": 200,\n    \"message\": \"success\",\n    \"data\": 0\n}",
  "description" : "",
  "requestBodyDefinition" : {
    "name" : "",
    "value" : { },
    "description" : "",
    "required" : false,
    "dataType" : "String",
    "type" : "",
    "defaultValue" : "",
    "validateType" : "",
    "error" : "",
    "expression" : "",
    "children" : [ ]
  },
  "responseBodyDefinition" : {
    "name" : "",
    "value" : { },
    "description" : "",
    "required" : false,
    "dataType" : "String",
    "type" : "",
    "defaultValue" : "",
    "validateType" : "",
    "error" : "",
    "expression" : "",
    "children" : [ ]
  }
}
================================
import redis

    sql = """ 
        select code from alarm_metric
        where id = #{body.id}
    """
    metric = db.selectOne(sql)
    if (metric != null) {
        redis.delete("ndmp-alarm-rule:" + metric.code)
    }
    return db.update("""
        update alarm_metric set code = #{body.code}, metirc_category = #{body.metircCategory},metirc_descr = #{body.metircDescr},metirc_name = #{body.metircName}, metirc_type_id = #{body.metircTypeId}
        where id = #{body.id}
    """)